<?php
	$this->set('title_for_layout', $this->Html->clean(strip_tags($parent['Category']['name'])));
?>
<div id="category-index">
	<h1><?php echo $this->Html->clean($parent['Category']['name']); ?></h1>
	<?php
		foreach ($categories as $item) {
			printf('<h2>%s</h2>', $this->Html->clean($item['Category']['name']));
			if (!empty($item['Post'])) {
				printf('<ul>');
				foreach ($item['Post'] as $post) {
					printf('<li>%1$s <span class="excerpt">(%2$s)</span></li>',
						$this->Html->link($post['title'], array(
							'plugin'     => 'lil_blogs',
							'controller' => 'posts',
							'action'     => 'view',
							'blog_id'    => $post['blog_id'], 
							'slug'       => $post['slug']
						), array('escape' => false)),
						$this->Time->i18nFormat($post['modified'])
					);
				}
				printf('</ul>');
				printf('<br />');
			} else {
				printf('<p>%s</p>', __d('lil_blogs', 'There are no posts yet.', true));
				printf('<br />');
			}
		}
	?>
</div>
